package com.sj.增删改查结点;

import java.beans.beancontext.BeanContext;

/**
 * @author sj
 * @date 2021/5/3
 **/
public class 链表加数据 {
    public static void main(String[] args) {
        LinkNode node = new LinkNode(2);
        LinkNode node1 = new LinkNode(4);
        LinkNode node2 = new LinkNode(1);
        LinkNode node3 = new LinkNode(8);
        LinkNode node4 = new LinkNode(6);
        LinkNode node5 = new LinkNode(3);
        LinkNode node6 = new LinkNode(7);
        链表加数据 a = new 链表加数据();
        a.addNode(node);
        a.addNode(node1);
        a.addNode(node2);
        a.addNode(node3);
        a.addNode(node4);
        a.addNode(node5);
        a.addNode(node6);

         //System.out.println(找中点.findMid(node).val);
  a.list(反转链表.reverseLinked(node));


    }
    public static void list(LinkNode node){

        if (node == null)return;
        LinkNode temp = node;
        while (true){
            System.out.println(temp);
            if (temp.next == null){
                break;
            }

            temp = temp.next;
        }

    }
    public static LinkNode addNode(LinkNode linkNode){
        LinkNode temp = head;
        while (true){
            if (temp.next == null){
                break;
            }

            temp = temp.next;
        }
        temp.next = linkNode;
        return head;
    }
   private static LinkNode head = new LinkNode();
}
